package com.zlf.sb.demo.juc;

/***
 *@title BankDemo
 *@description <TODO description class purpose>
 *@author wgc_j
 *@version 1.0.0
 *@create 2025-02-26 10:03
 **/
public class BankDemo {

    public static void main(String[] args) {
        final BankAccount account = new BankAccount(1000); // 开始余额为1000
        // 创建线程进行存款

        Thread depositThread = new Thread(() -> {
            account.deposit(500);
        });
        // 创建线程进行取款

        Thread withdrawThread = new Thread(() -> {
            account.withdraw(200);
        });
        depositThread.start();
        withdrawThread.start();
    }
}
